Reverting Current Module to a baseline

Hello,

So far I've written a script to analysis both the current and a baseline, within the script it modifies the objects that have changed since the baseline. Also it creates new objects that no longer exist in the current but only exist in the baseline; also it softdeletes new objects created since the baseline. My question is how would you reconstruct the current module's hierarchy based on the "object number" within the baseline?

-Jim

If anyone has written a script to "revert" the current module and is willing to share, it would be appreciated.
SystemAdmin - Wed Aug 08 00:37:43 EDT 2012

Re: Reverting Current Module to a baseline
Mathias Mamsch - Wed Aug 08 04:05:07 EDT 2012

You won't. Once you have the same number of objects in the module, then you can just reconstruct the hierarchy by ordering the objects like in the baseline, starting from the 1st object and then moving the second object after or below it, depending how it is in the source module. This may get you started:
 

// iterate through the baseline
for o in entire modSrc do {
   int nr = o."Absolute Number" 
   Object oTarget = null 
   // match the objects in the skip lists. Key: Absolute Number Value: Object in Target Module
   if (!find(skTargets, nr, oTarget)) {
      // TBD, XXX: How to handle error?
      // print "Not found: " nr "\n"
      continue     
   }
 
   if (cnt ++ == 0) {
      // move the first object to the start of the module, it only needs to be on top level. 
      if (oTarget != first modTgt) move (oTarget, after first modTgt)
      iOldLevel = 1
      oLastTarget = oTarget
   } else {
      // move all other objects relative ...            
      int iSrcLevel = level o
 
      if (iSrcLevel == iOldLevel + 1) {
         // The next object has a higher level, so move the next object below the last one
         move (oTarget, below oLastTarget) 
      } else if (iSrcLevel == iOldLevel) {
         // The next object has the same level, so move the next object after the last one
         move (oTarget, after oLastTarget)
      } else if (iSrcLevel < iOldLevel) {
         // The next object has smaller level, so we need to move after one of the last parents
         // iSrcLevel < iOldLevel -> e.g. Move back from Level 3 to level 1
         // Therefore we will move up parents by the difference 
         Object oTgtParent = oLastTarget
         int i; for (i = 0; i < iOldLevel - iSrcLevel; i++) oTgtParent = parent oTgtParent
         move (oTarget, after oTgtParent) 
      } else {
         error "WTH: " (identifier oTarget) " - " (iSrcLevel) " - " iOldLevel "\n"
      }
      iOldLevel   = iSrcLevel 
      oLastTarget = oTarget
   }
        
}

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Reverting Current Module to a baseline
llandale - Wed Aug 08 11:23:10 EDT 2012

If ..
  • you are willing to accept that objects purged since the baseline will be created with a different absolute number
  • deleted objects will need to be de-linked, both incoming and outgoing
  • new objects (created or undeleted) will need to be re-linked vis-a-vis the baseline, both incoming and outgoing
Then I wonder why bother "reverting" and instead just copy the baseline and start again, and re-link it all (code you need in any case). There is also some "make perfect copy" script out there that will insure the new module has the exact absolute numbers as a given one. All you lose is previous baselines.

If you must-must-must revert, then I think MM has some database-file hack to remove the offending intermediate baselines and make the target one "current".

-Louie